<script type="text/html" template>
    <link rel="stylesheet" href="{{ layui.setter.base }}style/css/reset.css">
    <link rel="stylesheet" href="{{ layui.setter.base }}style/css/transaction/allocation_index.css">
</script>
<div class="layui-fluid">
    <div class="layui-table-title">
        工单详细信息
    </div>
    <div class="layui-table-box-1">
        <ul class="layui-row">
            <li class="layui-col-md4 layui-col-sm4">
                <div>工单名称：<span id='tcReqName'></span></div>
                <div>OA申请编号：<span id="fil02"></span></div>
                <div>申请日期：<span id="fil10"></span></div>
            </li>
            <li class="layui-col-md4 layui-col-sm4">
                <div>工单编号：<span id='fil01'></span></div>
                <div>报废时间：
                    <span id="time"></span>
                </div>
                <div>
                    设备所属公司：<span id="oldazp"></span>
                </div>
            </li>
            <li class="layui-col-md4 layui-col-sm4">
                <div>工单状态：<span id="fil05"></span></div>
                <div>申请人：<span id="newazp"></span></div>

            </li>
        </ul>
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">报废说明:</label>
            <div class="layui-input-block">
                <textarea name="desc" id="fil21" readonly placeholder="设备不能使用" class="layui-textarea"></textarea>
            </div>
        </div>
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">备注:</label>
            <div class="layui-input-block">
                <textarea name="desc" id="fil07" readonly placeholder="请输入备注" class="layui-textarea"></textarea>
            </div>
        </div>
    </div>
    <table class="layui-table" id="LAY-app-content-comm"></table>
</div>
<script>
    layui.use(['admin', 'form', 'user', 'api', 'table', 'laydate'], function () {
        var $ = layui.$,
            setter = layui.setter,
            admin = layui.admin,
            form = layui.form,
            laydate = layui.laydate,
            router = layui.router(),
            api = layui.api,
            table = layui.table,
            search = router.search;
        $('[data-jump="transaction/cash"]').addClass('layui-this').attr('color', '#FFF');
        table.render({
            elem: '#LAY-app-content-comm',
            url: api.host + api.selectAssociatedDevice,
            skin: 'nob',
            where: {
                fil01: layui.router().search.fil01
            }, //设定异步数据接口的额外参数
            headers: { 'token': layui.sessionData(setter.tableName).token },
            cols: [
                [{
                    field: 'id',
                    title: '序号',
                    type: 'numbers',
                }, {
                    field: 'fia01',
                    title: '设备编号',

                }, {
                    field: 'fia02',
                    title: '设备名称',
                },
                {
                    field: 'fic02',
                    title: '设备类型',
                },
                {
                    field: 'pmc03',
                    title: '供应商',
                }, {
                    field: 'tcSeriesName',
                    title: '设备系列',
                }, {
                    field: 'fia05',
                    title: '设备型号',
                }, {
                    field: 'fia011',
                    title: '资产编号',
                }, {
                    field: 'azp02',
                    title: '所属公司',
                }, {
                    field: 'gem02',
                    title: '负责部门',
                }, {
                    field: 'tcFtyName',
                    title: '负责位置',
                }, {
                    field: 'gen02',
                    title: '负责人',
                }
                ]
            ],
            request: {
                pageName: 'pageNum' //页码的参数名称，默认：page
                ,
                limitName: 'pageSize' //每页数据量的参数名，默认：limit
            },
            page: true,
            limit: 10,
            text: {
                none: '暂无数据' //默认：无数据。注：该属性为 layui 2.2.5 开始新增
            },
            limits: [10, 15, 20, 25, 30],
            parseData: function (res) { //res 即为原始返回的数据

                if (res.code == -1) {
                    layer.alert(res.msg)
                    return
                }
                return {
                    "code": res.code, //解析接口状态
                    "msg": res.msg, //解析提示文本
                    "count": res.data.total, //解析数据长度
                    "data": res.data.list //解析数据列表
                }
            }
        });
        admin.req({
            url: api.host + api.selectWorkOrderByTY,
            data: {
                fil01: layui.router().search.fil01
            },
            done: function (res) {
                var text = ''
                if (res.data[0].fil05 == 0) {

                    text = '未提交'
                } else if (res.data[0].fil05 == 1) {
                    text = '待审核'
                }
                else if (res.data[0].fil05 == 6) {
                    text = 'OA送审中'
                }
                else if (res.data[0].fil05 == 9) {
                    text = '归档已完成'
                }
                $('#time').html(res.data[0].fil12)
                $('#fil05').html(text)
                $('#fil02').html(res.data[0].fil02)
                $('#fil07').val(res.data[0].fil07)
                $('#fil21').val(res.data[0].fil21)
                $('#fil01').html(res.data[0].fil01)
                $('#gen02').html(res.data[0].gen02)
                $('#oldazp').html(res.data[0].azp02)
                $('#fil21').html(res.data[0].fil21)
                $('#tcReqName').html(res.data[0].tcReqName)
                $('#newazp').html(res.data[0].gen02)
                $('#fil10').html(res.data[0].fil10)


            }
        });



    });
</script>